Previous Book Contents Book Index Next

Inside Macintosh: QuickTime /
Chapter 4 - Movie Resource Formats / Overview of the Movie Resource Atom


Sample Table Atoms

The sample table atom contains information for converting from media time to sample number to sample location. This atom also indicates how to interpret the sample (for example, whether to decompress the video sample and, if so, how). This section describes the format and content of the sample table atom.

The sample table has an atom type of 'stbl'. It contains the sample description atom, the time-to-sample atom, the sample-to-chunk atom, the sync sample atom, the sample size atom, the chunk offset atom, and the shadow sync atom.

Figure 4-23 shows the layout of the sample table atom.

Figure 4-23 The layout of a sample table atom

You define a sample table atom by specifying these elements:

The following sections discuss each of the atoms that may be contained in a sample table.

Sample Description Atoms

The sample description atom stores information for the decoding of samples in the media. In the case of video media, the sample descriptions are image description structures (see the chapter "Image Compression Manager" earlier in this book for more information about image descriptions). Figure 4-24 shows the layout of the sample description atom.

The sample description atom has an atom type of 'stsd'. The sample description atom contains a table of sample descriptions, each of which contains a single sample description. A media may have one or more sample descriptions, depending upon the number of different compression types used in the media. The sample-to-chunk atom identifies the sample description for each sample in the media by specifying the index into this table for the appropriate description (see "Sample-to-Chunk Atoms," which begins on page 4-26).

Figure 4-24 The layout of a sample description atom

You define a sample description atom by specifying these elements:

Time-to-Sample Atoms

Time-to-sample atoms store duration information for the samples in a media, providing a mapping from a time in a media to the corresponding data sample. The time-to-sample atom has an atom type of 'stts'.

You can determine the appropriate sample for any given time in a media by examining the time-to-sample atom (shown in Figure 4-25), which contains the time-to-sample atom table.

Figure 4-25 The layout of a time-to-sample atom

You define a time-to-sample atom by specifying these elements:

Figure 4-26 The layout of a time-to-sample table

You define a time-to-sample table by specifying these entries:

Entries in the table collect samples according to their order in the media and their duration. If consecutive samples have the same duration, a single table entry may be used to define more than one sample. In these cases, the count field indicates the number of consecutive samples that have the same duration. For example, if a video media has a constant frame rate, this table would have one entry.

Figure 4-27 shows an example of a time-to-sample table that is based on the data stream shown in Figure 4-22 on page 4-22. Figure 4-22 shows a total of nine samples that correspond in count and duration to the entries of the table shown in Figure 4-27. Even though samples 4, 5, and 6 are in the same chunk, sample 4 has a duration of 3, and samples 5 and 6 have a duration of 2.

Figure 4-27 An example of a time-to-sample table

Sync Sample Atoms

The sync sample atom identifies the key frames in the media. In a media that
contains compressed data, key frames define starting points for portions of a temporally compressed sequence (see the chapter "Image Compression Manager" in this book for more information about key frames and temporal compression in video data). The
key frame is self-contained--that is, it is independent of preceding frames. Subsequent frames may depend on the key frame.

Sync sample atoms have an atom type of 'stss'. The sync sample atom contains a table of sample numbers. Each entry in the table identifies a sample that is a key frame for the media. Figure 4-28 shows the layout of a sync sample atom.

If no sync sample atom exists, then all the samples are key frames.

Figure 4-28 The layout of a sync sample atom

You define a sync sample atom by specifying these elements:

Figure 4-29 The layout of a sync sample table

Sample-to-Chunk Atoms

As samples are added to a media, they are collected into chunks that allow optimized data access. A chunk may contain one or more samples. Chunks in a media may have different sizes, and the samples within a chunk may have different sizes. The sample-to-chunk atom stores chunk information for the samples in a media. Figure 4-30 shows the layout of the sample-to-chunk atom. By examining the sample-to-chunk atom, you can determine the chunk that contains a specific sample.

Figure 4-30 The layout of a sample-to-chunk atom

You define a sample-to-chunk atom by specifying these elements:

Figure 4-31 The layout of a sample-to-chunk table

You define a sample-to-chunk table by specifying these elements:

Figure 4-32 shows an example of a sample-to-chunk table that is based on the data stream shown in Figure 4-22.

Figure 4-32 An example of a sample-to-chunk table

Each table entry corresponds to a set of consecutive chunks, each of which contains the same number of samples. Furthermore, each of the samples in these chunks must use
the same sample description (see "Sample Description Atoms," which begins on page 4-23). Whenever the number of samples per chunk or the sample description changes, you must create a new table entry. If all the chunks have the same number of samples per chunk and use the same sample description, this table has one entry.

Sample Size Atoms

You use sample size atoms to identify the size of each sample in the media.

Sample size atoms have an atom type of 'stsz'. The sample size atom (shown in Figure 4-33) contains sample size information.

Figure 4-33 The layout of a sample size atom

You define a sample size atom by specifying these elements:

Figure 4-34 shows the sample size table for the data stream represented in Figure 4-22 on page 4-22.

Figure 4-34 An example of a sample size table

Chunk Offset Atoms

Chunk offset atoms identify the location of each chunk of data in the media's data stream.

Chunk offset atoms have an atom type of 'stco'. The chunk offset atom (shown in Figure 4-35) contains a table of offset information.

Figure 4-35 The layout of a chunk offset atom

You define a chunk offset atom by specifying these elements:

Figure 4-36 shows an example of the chunk offset table for the data stream represented by Figure 4-22 on page 4-22.

Figure 4-36 An example of a chunk offset table

Shadow Sync Atoms

Shadow sync atoms contain self-contained samples that are alternates for existing frame difference samples. Shadow sync atoms are used to optimize random access operations on a movie. Scrubbing is an example of such a random access operation. These atoms are used to enhance playback performance. See the chapter "Movie Toolbox" in this book for details on the SetMediaShadowSync and GetMediaShadowSync functions, which allow you to create an association between a frame difference sample and a sync sample.

Figure 4-37 shows the layout of a shadow sync atom. Shadow sync atoms have an atom type of 'stsh'. Each shadow sync atom contains a table with a frame difference number and a sync sample number.

Figure 4-37 The layout of a shadow sync atom

You define a shadow sync atom by specifying these elements:

Figure 4-38 The layout of a shadow sync table

A shadow sync table contains a frame difference sample number and a sync sample number.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996